#include "game.h"

int main(void) {

	// create a window
	initgraph(WIDTH, HEIGHT, SHOWCONSOLE);

	srand((unsigned) time(NULL));

	Snake snake;
	Point food = { rand() % WIDTH , rand() % HEIGHT };

	gameInit(&snake, &food);
	setbkcolor(WHITE);
	display(&snake, &food);

	while (true)
	{
		snakeMove(&snake);
		if (isEaten(&snake, &food))
		{
			snake.length++;
			createFood(&food);
		}
		display(&snake, &food);
		changeDirection(&snake);
		Sleep(100);
		//createFood(&food);
		
	}


	while (1);
	//closegraph();
	return 0;
}